<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex align-stretch benben-position-layout flex search_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex align-center justify-between flex-sub search_fd0_0'>
					<view class='flex align-center flex-sub search_fd0_0_c0'>
						<image class='search_fd0_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"517.png"'></image>
						<input class='flex-sub search_fd0_0_c0_c1' type="text" :placeholder="`搜索课程`" confirm-type="search" :focus="true" :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx" v-model="keyword" @confirm="addSearchHistoryFunc" />
					</view>
					<view class='flex flex-wrap align-center search_fd0_0_c1' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='search_fd0_0_c1_c0'>取消</text>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---搜索记录flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
				<view class='flex flex-wrap align-center search_fd1_0'>
					<text class='search_fd1_0_c0'>历史搜索</text>
					<image class='search_fd1_0_c1' mode="aspectFit" :src='STATIC_URL+"197.png"'
						@tap.stop="popupShow1702307714721=true"></image>
				</view>
				<view class='flex flex-wrap align-center search_fd1_1' v-if=" appSearchHistory.length>=0">
					<template v-for='(item,key0) in appSearchHistory'>
						<view class='flex flex-wrap align-center search_fd1_1_c0' @tap.stop="handleJumpDiy"
							data-type="navigateTo" :data-url="`/pages/sy/searchRusult/searchRusult?keyword=${item.name}`"
							@longpress="handleLongpressFunc(key0)" :key='key0'>
							<text class='search_fd1_1_c0_c0'>{{item.name}}</text>
							<image class='search_fd1_1_c0_c1' mode="aspectFit" :src='STATIC_URL+"198.png"'
								@tap.stop="deleteSearchHistoryFunc(item.name)" v-if=" key0==removeIndex"></image>
						</view>
					</template>

				</view>
				<text class='search_fd1_2' v-if=" appSearchHistory.length<=0">暂无历史记录</text>
			</view>

			<!---搜索记录flex布局结束-->
			<benben-popup v-model="popupShow1702307714721" :mask="true" :mask-close-able="true" mode='center'>
				<!---删除历史记录弹窗flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center search_flex_2">
					<text class='search_fd2_0'>提示</text>
					<text class='search_fd2_1'>确定删除历史记录？</text>
					<view class='flex flex-wrap align-center search_fd2_2'>
						<button class='search_fd2_2_c0' @tap.stop="popupShow1702307714721=false">取消</button>
						<button class='search_fd2_2_c1' @tap.stop="emptySearchHistoryFunc()">确定</button>
					</view>
				</view>
			</benben-popup>
			
		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				"popupShow1692100153978": false,
				"popupShow1661481796822": false,
				"popupShow1702307714721": false,
				"dataLists": [],
				"xainshi": false,
				"associateList": [],
				"dataDetails": {
					"aid": "",
					"order_sn": "",
					"order_money": "",
					"payable_money": "",
					"coupon_id": "",
					"coupon_money": "",
					"send_time": "",
					"receive_time": "",
					"pay_time": "",
					"discount_money": "",
					"create_time": "",
					"pay_type": "",
					"status": "",
					"pay_type_str": "",
					"order_info": {
						"receiver_mobile": "",
						"receiver_address": "",
						"receiver_name": "",
						"remark": "",
						"province": "",
						"city": "",
						"district": "",
						"sex": "",
						"label_name": "",
						"express_price": "",
						"pickup_code": "",
						"pickup_img": ""
					},
					"order_goods_list": [],
					"shop_info": {
						"aid": "",
						"store_name": "",
						"store_logo": "",
						"store_logo_id": ""
					},
					"btn_list": {
						"cancel_order": "",
						"go_pay": "",
						"remind_send": "",
						"remind_already": "",
						"apply_invoice": "",
						"view_invoice": "",
						"apply_refund": "",
						"view_logistics": "",
						"confirm_receive": "",
						"evaluate": "",
						"delete_order": "",
						"pay_balance": ""
					},
					"is_multiple_package": "",
					"order_type": "",
					"advance_sn": "",
					"usermerchant_id": "",
					"discount_str": "",
					"surplus_receive_time": "",
					"group_info": {
						"join_timeout": "",
						"activity_status": "",
						"group_members_nums": "",
						"join_number": "",
						"status_txt": ""
					},
					"group_user": [],
					"real_money": "",
					"cancel_surplus_second": "",
					"balance_payment_stime": "",
					"balance_payment_etime": "",
					"receive_surplus_time": "",
					"goods_total": "",
					"pay_status": ""
				},
				"inputList": [],
				"removeIndex": -1,
				"keyword": null
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},
			appSearchHistory() { // 搜索历史
				return this.$store.state.appSearchHistory
			},
		},
		watch: {},
		onLoad(options) {
			let {
				keyword
			} = options
			if (keyword !== undefined) this.keyword = keyword;
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//长按事件
			handleLongpressFunc(index) {
				this.removeIndex = index;
			},
			//添加搜索历史
			addSearchHistoryFunc(name) {
				if (this.keyword != '') {
					this.$store.commit('appSearchHistoryAdd', {
						"name": this.keyword
					})
					this.$urouter.navigateTo(`/pages/sy/searchRusult/searchRusult?keyword=${this.keyword}`);
				} else {
					this.$store.commit('appSearchHistoryAdd', {
						"name": name
					})
					this.$urouter.navigateTo(`/pages/sy/searchRusult/searchRusult?keyword=${name}`);
				}
			},
			//删除搜索历史
			deleteSearchHistoryFunc(name) {
				this.$store.commit('appSearchHistoryDel', {
					"name": name
				})
				this.removeIndex = -1;
			},
			//清空搜索记录
			emptySearchHistoryFunc() {
				this.$store.commit('appSearchHistoryClean', '')
				this.popupShow1702307714721 = false;
				this.removeIndex = -1;
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: var(--benbenbgColor1);
		background-size: 100% auto;
	}

	.search_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.search_fd0_0_c1_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 40rpx;
		margin: 0rpx 0rpx 0rpx 6rpx;
	}

	.search_fd0_0_c1 {
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.search_fd0_0_c0_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
	}

	.search_fd0_0_c0_c0 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.search_fd0_0_c0 {
		background: #F8F8FA;
		height: 72rpx;
		padding: 0rpx 24rpx 0rpx 24rpx;
		margin: 0rpx 0rpx 0rpx 30rpx;
		border-radius: 10rpx;
		width: 610rpx;
	}

	.search_fd0_0 {
		padding: 0rpx 24rpx 0rpx 0rpx;
		line-height: 88rpx;
	}

	.search_fd1_2 {
		font-size: 24rpx;
		font-weight: 400;
		color: #666666;
		margin: 0rpx 0rpx 24rpx 24rpx;
	}

	.search_fd1_1_c0_c1 {
		width: 18rpx;
		height: 18rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.search_fd1_1_c0_c0 {
		font-size: 24rpx;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
	}

	.search_fd1_1_c0 {
		background: rgba(248, 248, 248, 1);
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		background-size: 100% auto !important;
		padding: 0rpx 40rpx 0rpx 40rpx;
		line-height: 56rpx;
		margin: 0rpx 12rpx 24rpx 12rpx;
	}

	.search_fd1_1 {
		padding: 0rpx 0rpx 0rpx 12rpx;
	}

	.search_fd1_0_c1 {
		width: 24rpx;
		height: 28rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.search_fd1_0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
	}

	.search_fd1_0 {
		padding: 32rpx 0rpx 24rpx 0rpx;
		margin: 0rpx 24rpx 0rpx 24rpx;
	}

	.search_flex_2 {
		background: #fff;
		margin: 0rpx 105rpx 0rpx 105rpx;
		background-size: #eee;
		border-radius: 25rpx 25rpx 25rpx 25rpx;
		padding: 40rpx 0rpx 0rpx 0rpx;
	}

	.search_fd2_2_c1 {
		background: transparent;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: #988AFB;
		width: 269rpx;
		height: 110rpx;
	}

	.search_fd2_2_c0 {
		border-right: 1px solid #EEEEEE;
		background: transparent;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor2);
		height: 110rpx;
		width: 270rpx;
	}

	.search_fd2_2 {
		border-top: 1px solid #eee;
	}

	.search_fd2_1 {
		font-size: 32rpx;
		font-weight: 400;
		line-height: 52rpx;
		color: #333333;
		margin: 40rpx 0rpx 39rpx 0rpx;
	}

	.search_fd2_0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 45rpx;
	}

	.search_flex_3 {
		background: var(--benbenbgColor1);
		margin: 0rpx 105rpx 0rpx 105rpx;
		background-size: #eee;
		border-radius: 25rpx 25rpx 25rpx 25rpx;
		padding: 40rpx 0rpx 0rpx 0rpx;
	}

	.search_fd3_2_c1 {
		background: var(--benbenbgColor1);
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor5);
		width: 269rpx;
		height: 110rpx;
	}

	.search_fd3_2_c0 {
		border-right: 1px solid #EEEEEE;
		background: var(--benbenbgColor1);
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor2);
		height: 110rpx;
		width: 270rpx;
	}

	.search_fd3_2 {
		border-top: 1px solid #eee;
	}

	.search_fd3_1 {
		font-size: 32rpx;
		font-weight: 400;
		line-height: 52rpx;
		color: #333333;
		margin: 40rpx 0rpx 39rpx 0rpx;
	}

	.search_fd3_0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 45rpx;
	}

	.search_fd4_0_c1_c0_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #333;
	}

	.search_fd4_0_c1_c0_c0 {
		width: 80rpx;
		height: 80rpx;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		margin: 0rpx 0rpx 16rpx 0rpx;
	}

	.search_fd4_0_c1 {
		padding: 0rpx 0rpx 58rpx 0rpx;
	}

	.search_fd4_0_c0_c2_c0 {
		width: 40rpx;
		height: 40rpx;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
	}

	.search_fd4_0_c0_c2 {
		margin: 0rpx 2rpx 0rpx 0rpx;
	}

	.search_fd4_0_c0_c1_c1 {
		font-size: 32rpx;
		font-weight: 700;
		color: #333;
		margin: 0rpx 16rpx 0rpx 16rpx;
	}

	.search_fd4_0_c0_c1_c0 {
		width: 32rpx;
		height: 10rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.search_fd4_0_c0_c1 {
		padding: 40rpx 0rpx 48rpx 0rpx;
	}

	.search_fd4_0_c0_c0 {
		width: 40rpx;
	}

	.search_fd4_0_c0 {
		padding: 0rpx 13rpx 0rpx 0rpx;
	}

	.search_fd4_0 {
		background: var(--benbenbgColor1);
		background-size: 100% auto !important;
		border-radius: 24rpx 24rpx 0rpx 0rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
	}
</style>